//
//  serviceSetSSID.m
//  wAudioShare
//
//  Created by 赵帅 on 13-9-23.
//  Copyright (c) 2013年 赵帅. All rights reserved.
//

#import "serviceSetSSID.h"

@implementation serviceSetSSID
#pragma mark Initialization & Deallocation

-(id)initWithDelegate:(id <serviceSetSSIDDelegate>) aDelegate
{
	self = [super init];
	if (self)
	{
		self.m_serviceHandler = aDelegate;
	}
    
	return self;
}



#pragma mark -
#pragma mark Configure the request
-(NSURL*)targetURL
{
    NSString * ipStr = [m_dicSendData objectForKey:@"baseurl"];
    NSString * newID = [m_dicSendData objectForKey:@"newssid"];
    
    NSString *urlStr = [NSString stringWithFormat:@"%@/httpapi.asp?command=setSSID:%@",ipStr,newID];
	NSURL *theUrl = [[NSURL alloc] initWithString:urlStr];
	
	return theUrl;
}

-(void)configureRequest
{
	[super configureRequest];
	[m_request setRequestMethod:@"GET"];
}

#pragma mark -
#pragma mark Parse the response
-(void)parseResponseData:(NSData *)data
{
	[super parseResponseData:data];
    
}

#pragma mark -
#pragma mark Pass Data To UI
-(void)passDataOut
{
	[super passDataOut];
	
	if (nil != self.m_serviceHandler
		&& [self.m_serviceHandler respondsToSelector:@selector(serviceSetSSIDCallBack:)])
	{
        [self.m_serviceHandler performSelectorOnMainThread:@selector(serviceSetSSIDCallBack:) withObject:m_dicReceiveData waitUntilDone:YES];
	}
}
@end
